g.setColor(Color.red); g.drawOval(10,20,200,100);
import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class MyApplet extends Applet { public void paint(Graphics g) { for(int i=0;i<10;i++) { if(i%2==0) g.setColor(Color.blue); else g.setColor(Color.red); g.fillOval(i*10,i*10,200-i*20,200-i*20); } } } //<applet code=MyApplet width=200 height=200 ></applet>
import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class MyApplet extends Applet { public void paint(Graphics g) { g.setColor(Color.red); g.fillRect(5,5,90,90); g.setColor(Color.green); g.fillRect(105,5,90,90); g.setColor(Color.blue); g.fillRect(5,105,90,90); g.setColor(Color.yellow); g.fillRect(105,105,90,90); } } //<applet code=MyApplet width=200 height=200 ></applet>
import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class MyApplet extends Applet { public void paint(Graphics g) { int xp[]={100,200,0}; int yp[]={0,170,170}; g.setColor(Color.blue); g.fillPolygon(xp,yp,3); g.setColor(Color.orange); g.fillOval(75,75,50,50); g.setColor(Color.red); g.drawString("CCIT Amravati",65,190); } } //<applet code=MyApplet width=200 height=200 ></applet>
import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class MyApplet extends Applet { public void paint(Graphics g) { Color co[]={Color.red,Color.blue,Color.green, Color.magenta,Color.cyan,Color.yellow }; for(int i=0;i<12;i++) { g.setColor(co[i%6]); g.fillArc(0,0,200,200,i*30,30); } } } //<applet code=MyApplet width=200 height=200 ></applet>
import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class MyApplet extends Applet { public void paint(Graphics g) { for(int x=0;x<256;x++) { Color clr=new Color(255-x,0,x); g.setColor(clr); g.drawLine(x,0,x,200); } } } //<applet code=MyApplet width=200 height=200 ></applet>